import Vue from 'vue'
import VueRouter from 'vue-router'
import Pie from '../views/Pie'
import Bar from '../views/Bar'
import Book from "../views/Book";
import Add from "../views/Add"
import Update from "../views/Update"
import Common from "../views/Common"
import App from "../App"

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    name: "图书管理",
    component: Common,
    redirect : "/book",
      show: true,
    children:[
        {
            path: "/book",
            name:"查询",
            component: Book,
    }, {
            path: "/add",
            name:"新增",
            component: Add,
        }
    ]

  },{
        path: "/nav",
        name: "图书分析",
        component: Common,
        show: true,
        children:[
            {
                path: "/bar",
                name:"柱状图",
                component: Bar,
            }, {
                path: "/pie",
                name:"饼状图",
                component: Pie,
            }
        ]
    }
    ,{
        path: "/update",
        component: Update,
        show: false
    }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
